﻿@namespace AntSK.Pages.Setting.User
@using AntSK.Domain.Repositories
@using AntSK.Models
@page "/setting/user/add"
@page "/setting/user/add/{UserId}"
@using AntSK.Services.Auth
@inherits AuthComponentBase
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "AntSKAdmin")]

<PageContainer Title="新增用户">
    <ChildContent>
        <Card>
            <Form Model="@_userModel"
                  Style="margin-top: 8px;"
                  OnFinish="HandleSubmit">
                <FormItem Label="工号" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
                    <Input Placeholder="请输入用户工号" @bind-Value="@context.No" />
                </FormItem>
                <FormItem Label="用户名称" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
                    <Input Placeholder="请输入用户名称" @bind-Value="@context.Name" />
                </FormItem>
                <FormItem Label="用户密码" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
                    <Input Type="password" Placeholder="请输入用户密码" @bind-Value="@context.Password" />
                </FormItem>
                <FormItem Label="用户备注" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
                    <Input Placeholder="请输入用户备注" @bind-Value="@context.Describe" />
                </FormItem>

                <FormItem Label="菜单权限" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
                    <Select Mode="multiple"
                            @bind-Values="_menuKeys"
                            Placeholder="选择菜单权限"
                            TItemValue="string"
                            TItem="string"
                            Size="@AntSizeLDSType.Default">
                        <SelectOptions>
                            @foreach (var menu in menuList)
                            {
                                <SelectOption TItem="string" TItemValue="string" Value="@menu.Key" Label="@menu.Name" />
                            }
                        </SelectOptions>
                    </Select>
                </FormItem>

                <FormItem Label=" " Style="margin-top:32px" WrapperCol="LayoutModel._submitFormLayout.WrapperCol">
                    <Button Type="primary" OnClick="HandleSubmit">
                        保存
                    </Button>
                    <Button OnClick="Back">
                        返回
                    </Button>
                </FormItem>
            </Form>
        </Card>
    </ChildContent>
</PageContainer>

@code {

}
